<template>
    <web-view :webview-styles="webviewStyles" @message="onMessage" src="/static/maplibre.html"></web-view>
</template>

<script>
  export default {
    data() {
      return {
        params: {},
        webviewStyles: {
          progress: {
            color: "#FF3333"
          }
        }
      }
    },
	mounted(){
		// uni.webView.postMessage({
		//   data: '地图选点'
		// });
	},
	methods:{
		onMessage(e){
			console.log(e.detail.data);
			uni.$emit('choosePositionEvent', {
				msg: e.detail.data
			});
			uni.navigateBack(0)
		}
	},
    onLoad(event) {
      this.params = event
      if (event.title) {
        uni.setNavigationBarTitle({
          title: event.title
        })
      }
    }
  }
</script>
